#ifndef _WCDMAAPI_H_
#define _WCDMAAPI_H_

#include "syscore.h"
#include "apis.h"
#include "network_frame.h"

#ifdef __cplusplus
extern "C" {
#endif

#define WCDMA_MODULE_IP       "192.168.178.111"
#define WCDMA_BOARD_IP        "192.168.178.204"
#define WCDMA_BOARD_UDP_PORT  "5070"
#define WCDMA_MODULE_UDP_PORT "5071"
/**
 *****************************************************************************************
 * Message Type and message code between WCDMA board and WCDMA module
 * the same for request and response
 *
 *****************************************************************************************
 */
#define WCDMA_MESSAGE_TYPE_LENGTH               2
#define WCDMA_MESSAGE_CODE_LENGTH               2

 //configuration command
#define WCDMA_MESSAGE_TYPE_BS_CONFIG                "03"    //configure frequency, 
                                                            //lac and so on
#define WCDMA_MESSAGE_CODE_BS_CONFIG_PARAM          "01"    //
#define WCDMA_MESSAGE_CODE_BS_CONFIG_PARAM_RSP      "02"    //
#define WCDMA_MESSAGE_CODE_BS_CONFIG_STATUS         "09"    //
#define WCDMA_MESSAGE_CODE_BS_CONFIG_POWER          "12"    //
#define WCDMA_MESSAGE_CODE_BS_CONFIG_POWER_RSP      "13"    //
#define WCDMA_MESSAGE_CODE_BS_CONFIG_TIME           "18"    //
#define WCDMA_MESSAGE_CODE_BS_CONFIG_TIME_RSP       "19"    //
#define WCDMA_MESSAGE_CODE_BS_CONFIG_IP             "20"    //
#define WCDMA_MESSAGE_CODE_BS_CONFIG_IP_RSP         "21"    //
#define WCDMA_MESSAGE_CODE_BS_CONFIG_RESTART        "22"    //
#define WCDMA_MESSAGE_CODE_BS_CONFIG_RESTART_RSP    "23"    //
#define WCDMA_MESSAGE_CODE_BS_CONFIG_IMSI           "24"    //
#define WCDMA_MESSAGE_CODE_BS_CONFIG_IMSI_RSP       "25"    //


//radio output
#define WCDMA_MESSAGE_TYPE_RADIO_OUTPUT              "00"
#define WCDMA_MESSAGE_CODE_RADIO_OUTPUT_START        "01"
#define WCDMA_MESSAGE_CODE_RADIO_OUTPUT_START_RSP    "02"
#define WCDMA_MESSAGE_CODE_RADIO_OUTPUT_STOP         "04"
#define WCDMA_MESSAGE_CODE_RADIO_OUTPUT_STOP_RSP     "05"

//runtime command
#define WCDMA_MESSAGE_TYPE_BS_SETTING                "08"    //configure frequency, 
#define WCDMA_MESSAGE_CODE_BS_SETTING_PILOT          "00" 
#define WCDMA_MESSAGE_CODE_BS_SETTING_PILOT_RSP      "01" 
#define WCDMA_MESSAGE_CODE_BS_SETTING_AUTO_LAC       "02"
#define WCDMA_MESSAGE_CODE_BS_SETTING_AUTO_LAC_RSP   "03"
#define WCDMA_MESSAGE_CODE_BS_SETTING_SWVERSION      "04"   //require software version
#define WCDMA_MESSAGE_CODE_BS_SETTING_SWVERSION_RSP  "04"   //require software version
#define WCDMA_MESSAGE_CODE_BS_SETTING_SET_DAC        "06"
#define WCDMA_MESSAGE_CODE_BS_SETTING_SET_DAC_RSP    "07"
#define WCDMA_MESSAGE_CODE_BS_SETTING_GET_DAC        "08"  
#define WCDMA_MESSAGE_CODE_BS_SETTING_GET_DAC_RSP    "09" 
#define WCDMA_MESSAGE_CODE_BS_SETTING_EXTPWR         "17"
#define WCDMA_MESSAGE_CODE_BS_SETTING_EXTPWR_RSP     "18"

#define WCDMA_MESSAGE_TYPE_BS_PARAM                  "09"    //configure frequency, 
#define WCDMA_MESSAGE_CODE_BS_PARAM_REQUEST          "01" 
#define WCDMA_MESSAGE_CODE_BS_PARAM_RESPONSE         "02" 
#define WCDMA_MESSAGE_CODE_BS_PARAM_REPORT           "04"

//message success or failure
#define WCDMA_MESSAGE_RESPONSE_CODE_SUCCESS          "0"
#define WCDMA_MESSAGE_RESPONSE_CODE_FAILURE          "1"

//device status
#define WCDMA_MESSAGE_STATUS_NORMAL                  "1"
#define WCDMA_MESSAGE_STATUS_ABNORMAL                "0"

//some fix message body
#define WCDMA_MESSAGE_BODY_SETPOWER              "SETPOWER"
#define WCDMA_MESSAGE_BODY_MCC                   "MCC:"
#define WCDMA_MESSAGE_BODY_MNC                   "MNC:"
#define WCDMA_MESSAGE_BODY_LAC                   "LAC:"
#define WCDMA_MESSAGE_BODY_RAC                   "RAC:"
#define WCDMA_MESSAGE_BODY_CELLID                "CELLID:"
#define WCDMA_MESSAGE_BODY_PSC                   "PSC:"
#define WCDMA_MESSAGE_BODY_ARFCNo                "ARFCNo:"
#define WCDMA_MESSAGE_BODY_AT                    "@"
#define WCDMA_MESSAGE_BODY_SPACE                 " "


//internal marco
#define TICK_INTERVAL                  1000
#define TICK_SECOND                    (TICK_INTERVAL / 1000)    

#define INVALID_CMD_CODE               0xffff
#define INVALID_SRC_ID                 0xffff

#define UE_ID_LENGTH                   16 
    
typedef enum {
    WCDMA_MODULE_IDLE,
	WCDMA_MODULE_PRECONFIG,    
	WCDMA_MODULE_CONFIGING,
    WCDMA_MODULE_CONFIGED,
    WCDMA_MODULE_RESTART,
    WCDMA_MODULE_RUNNING,
    WCDMA_MODULE_SHUTDOWN,
    WCDMA_MODULE_NSYNC 
} wcdmaModuleState_t;

typedef struct
{
    U32   paramType;
    U32   paramLength;
}wcdmaParamCode_t;

typedef struct
{
    U32    mcc;
    U32    mnc;
	U32    lac;
    U32    arfcn;	
    U32    psc;      //
    U32    rac;
    U32    cellid;
	U32    autolac;
	U32    dac;	
	U32    txPower;
	U32    rxPower;
}wcdmaParam_t;

typedef struct
{
     U16           srcID;
     CMDHEADER     cmdHdr;
}tlvCmdRecord_t;

#ifdef __cplusplus
}
#endif

#endif

